package com.gohead.server.crawel.models;

import com.google.common.collect.Maps;

import java.io.Serializable;
import java.util.Map;
import java.util.StringJoiner;

/**
 * web request result, maybe failed
 */
public class WebFetched implements Serializable {
    private static final long serialVersionUID = 7023195580442010238L;
    /**
     * web request id
     */
    private String requestId;

    /**
     * request result
     */
    private String document;

    /**
     * request uri
     */
    private String uri;

    /**
     * request extras params
     */
    private Map<String, Object> extras = Maps.newConcurrentMap();

    public String getRequestId() {
        return requestId;
    }

    public void setRequestId(String requestId) {
        this.requestId = requestId;
    }

    public String getDocument() {
        return document;
    }

    public void setDocument(String document) {
        this.document = document;
    }

    public String getUri() {
        return uri;
    }

    public void setUri(String uri) {
        this.uri = uri;
    }

    public Map<String, Object> getExtras() {
        return extras;
    }

    public void setExtras(Map<String, Object> extras) {
        this.extras = extras;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("WebFetched{");
        sb.append("requestId='").append(requestId).append('\'');
        sb.append(", document='").append(document).append('\'');
        sb.append(", uri='").append(uri).append('\'');
        sb.append(", extras=").append(extras);
        sb.append('}');
        return sb.toString();
    }
}
